﻿using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DemoApp1
{
    /// <summary>
    /// 键值对
    /// </summary>
    class KeyValueDemo
    {

        public  void Demo()
        {
            IDictionary<string, string> dict1 = new Dictionary<string, string>();

            dict1.Add("A", "a");
            dict1["E"] = "000";
            dict1.Add("B", "b");
            dict1.Add("C", "c");
            dict1.Add("D", "d");


            var str = dict1["A"];

            var keys = dict1.Keys;

            if (dict1.ContainsKey("E"))
            {
                dict1["QQ"] = "123";
            }


            foreach (KeyValuePair<string, string> kv in dict1)
            {
                var key = kv.Key;
                var vue = kv.Value;
            }



            var hashtable = new Hashtable(); 
            hashtable["A"] = new object();
            hashtable["E"] = new Dictionary<string, int>();
            //{"A":"a", "B":"b" }
        
            var nameValues = new NameValueCollection();

        }


    }
}
